package hello;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class MessageProducerService {

    @Autowired
    RedisTemplate<String, Message> redisTemplate;

    public Long sendMessage(Message message) {
        System.out.println("发送了"+ message);
        return redisTemplate.opsForList().leftPush("queue", message);
    }

}
